/**
 * 热区推荐管理
 */

import request from '@/api/request';
import {
    CreateTableRequestData,
    UpdateTableRequestData,
    GetDetailRequestData,
    GetTableRequestData,
    GetDetailResponseData,
    GetTableResponseData
} from './types/hot-zone-recommendation';

// 增
export function addTableDataApi(data: CreateTableRequestData) {
    return request({
        url: '/web/api/hot/zone/add',
        method: 'post',
        data
    });
}

// 提示文字添加
export function addTextApi(data: {hintText: string | null}) {
    return request({
        url: '/web/api/homepage/hint/text/update',
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        method: 'post',
        data
    });
}

// 提示文字获取
export function searchTextApi() {
    return request({
        url: '/web/api/homepage/hint/text/search',
        method: 'get'
    });
}

// 删
export function deleteTableDataApi(id: number) {
    return request({
        url: `/web/api/hot/zone/delete/${id}`,
        method: 'delete'
    });
}

// 编辑
export function updateTableDataApi(data: UpdateTableRequestData) {
    return request({
        url: '/web/api/hot/zone/update',
        method: 'post',
        data
    });
}

// 查热区详情
export function getHotZoneDetailApi(data: GetDetailRequestData) {
    return request<GetDetailResponseData>({
        url: '/web/api/hot/zone/query/detail',
        method: 'post',
        data
    });
}

// 查热区推荐列表
export function getTableDataApi(data: GetTableRequestData) {
    return request<GetTableResponseData>({
        url: '/web/api/hot/zone/search',
        method: 'post',
        data
    });
}
